package com.VancouverTongue.bean;

import com.VancouverTongue.database.HelpObj;

public class Account {
	// front end
	public String userId="";
	public String password="";
	public String email="";
	// String phone;
	public Block block;
	public int level;
	public String description="";
	public String avatar="";

	// data end
	public int descriptionId;

	public Account() {
		userId = null;
		password = null;
		level = 0;
		email = null;
		descriptionId = 0;
		avatar = null;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = HelpObj.HTMLcheck(userId);
		this.userId = HelpObj.checkString(this.userId, 15);
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = HelpObj.HTMLcheck(password);
		this.password = HelpObj.checkString(this.password, 20);
		//TODO:encoding
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = HelpObj.HTMLcheck(email);
		this.email = HelpObj.checkString(this.email, 55);
	}

	public Block getBlock() {
		return block;
	}

	public void setBlock(Block block) {
		this.block = block;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = HelpObj.HTMLcheck(description);
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = HelpObj.HTMLcheck(avatar);
		this.avatar = HelpObj.checkString(this.avatar, 150);
	}

	public int getDescriptionId() {
		return descriptionId;
	}

	public void setDescriptionId(int descriptionId) {
		this.descriptionId = descriptionId;
	}

	public void Setaccount(String uid, String psd, String emailaddr,
			String image) {
		userId = HelpObj.HTMLcheck(uid);
		password = HelpObj.HTMLcheck(psd);
		email = HelpObj.HTMLcheck(emailaddr);
		avatar = HelpObj.HTMLcheck(image);
		userId = HelpObj.checkString(this.userId, 15);
		password = HelpObj.checkString(this.password, 20);
		email = HelpObj.checkString(this.email, 55);
		avatar = HelpObj.checkString(this.avatar, 150);
	}

}
